﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace BreakOutBattles.Game
{
    /// <summary>
    /// Offers a set of commonly used helper methods.
    /// </summary>
    public static class ToolBox
    {
        /// <summary>
        /// Measures the width of a string.
        /// </summary>
        /// <param name="str">The string to be measured.</param>
        /// <param name="font">The font used to measure the string.</param>
        /// <returns>The width of the specified string, in pixels.</returns>
        public static float StringWidth(string str, SpriteFont font)
        {
            return font.MeasureString(str).X;
        }

        /// <summary>
        /// Measures the height of a string.
        /// </summary>
        /// <param name="str">The string to be measured.</param>
        /// <param name="font">The font used to measure the string.</param>
        /// <returns>The height of the specified string, in pixels.</returns>
        public static float StringHeight(string str, SpriteFont font)
        {
            return font.MeasureString(str).Y;
        }

        public static string SplitToLines(string str, int preferedLineLength)
        {
            return str.Insert(preferedLineLength + 1, "\\n");
        }
    }
}
